package com.bwie.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @description:
 * @author: zyc
 * @create: 2024-07-18 16:34
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {

    private Integer code=200;
    private Boolean flag=true;
    private String msg;
    private Object data;

    public static  R ok(){
        R r = new R();
        r.code=200;
        r.flag=true;
        r.msg="操作成功";
        return r;
    }
    public static  R ok(Object data){
        R r = new R();
        r.code=200;
        r.flag=true;
        r.msg="操作成功";
        r.data=data;
        return r;
    }
    public static  R error(Object data){
        R r = new R();
        r.code=404;
        r.flag=false;
        r.msg="操作失败";
        r.data=data;
        return r;
    }
}
